package polymorphismTest;

import java.util.Scanner;

public class PloymorephismTest {
    public static void main(String[] args) {
        System.out.println("请选择支付方式:1.平台支付---2.银行卡支付---3.信用卡支付");
        Scanner scanner=new Scanner(System.in);
        int choice=scanner.nextInt();
        Pay payWay=null;
        switch (choice){
            case 1:
                payWay=new Platform(input());
                break;
            case 2:
                payWay=new Bank(input());
                break;
            case 3:
                payWay=new CreditCard(input());
                break;
            default:
                System.out.println("输入错误");
        }
            payWay.payment();


    }
    public static double input(){
        System.out.println("请输入支付金额:");
        Scanner scanner=new Scanner(System.in);
        double money=scanner.nextDouble();
        return money;
    }
}
